<template>
	<view class="page-container">
		<view class="padded-15">
			<view class="list-item">
				<view class="font-16" v-if="detail.type == '1'">行业预警</view>
				<view class="font-16" v-else-if="detail.type == '2'">产品预警</view>
				<view class="clearfix padded-t-5 font-12 color-B1B8C7">
					<view class="pull-left">
						<text>系统通知</text>
					</view>
					<view class="pull-right">
						<text>{{ detail.create_time }}</text>
					</view>
				</view>
			</view>
			<view class="list-item">
				<view>
					<rich-text class="content color-646D7F" :nodes="detail.jswa"></rich-text>
				</view>
				<view class="padded-t-10">
					<text class="color-646D7F">涉及您的产品：</text>
				</view>
				<view>
					<text class="color-646D7F">{{ detail.cpmc }}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: 0,
				detail: {
					create_time: '',
					jswa: '',
					cpmc: ''
				}
			}
		},
		onLoad(options) {
			this.id = options.id
			this.getDetail()
		},
		methods: {
			getDetail() {
				if(this.id == 0 || !this.id) {
					return
				}
				uni.request({
				    url: 'https://wn.wdyky.com/index/jrgl/fxlist', // 接口地址。
				    data: {
				        id: this.id,mid:localStorage.getItem('mid')
				    },
				    success: (res) => {
				        console.log(res)
						if(res.statusCode == 200) {
							if(res.data.code == 1) {
								if(res.data.data.length > 0) {
									this.detail = res.data.data[0]
								}
								
							}
						}else {
							uni.showToast({
								title: res.errMsg,
								duration: 2000
							})
							
						}
					},
				})
			}
		}
	}
</script>

<style lang="scss">
	@import '@/static/product.scss';
	
	.list-item {
		background-color: #FFFFFF;
		padding: 15px;
		border-radius: 10px;
		margin-bottom: 10px;
		box-shadow: 0 0 2px 2px rgba(242, 242, 242, 0.7);
		
		.content {
			word-break: break-all;
		}
	}
	
	// 控制富文本内容中图片宽度最大不超过容器宽度
	::v-deep .list-item .content img {
		max-width: 100%;
	}
	
</style>
